package game.MazeRunner;

public class ItemGenerator {
	ItemGenerator() {}
	
	ItemGenerator(MazeGenerator maze) {
		for(int i=0; i<9; i++) {
			if(i<5) {
				x[i] = (int)(Math.random()*maze.sizeX);
				y[i] = (int)(Math.random()*maze.sizeY);
				for(int j=0; j<i; j++) {
					while(x[i]==x[j] && y[i]==y[j]) {
						x[i] = (int)(Math.random()*maze.sizeX);
						y[i] = (int)(Math.random()*maze.sizeY);
					}
				}
				if((x[i]!=maze.endingPoint[0] && y[i]!=maze.endingPoint[1]) && (x[i]!=maze.startingPoint[0] && y[i]!=maze.startingPoint[1]))
					maze.board[x[i]][y[i]].hasTeleport = true;
			}
			else {
				x[i] = (int)(Math.random()*maze.sizeX);
				y[i] = (int)(Math.random()*maze.sizeY);
				for(int j=0; j<i; j++) {
					while(x[i]==x[j] && y[i]==y[j]) {
						x[i] = (int)(Math.random()*maze.sizeX);
						y[i] = (int)(Math.random()*maze.sizeY);
					}
				}
				if((x[i]!=maze.endingPoint[0] && y[i]!=maze.endingPoint[1]) && (x[i]!=maze.startingPoint[0] && y[i]!=maze.startingPoint[1]))
					maze.board[x[i]][y[i]].isFreezed = true;
			}
		}
	}
	
	int[] x = new int[9];
	int[] y = new int[9];
}